/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.generarhorario.itschapala.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author RaygozaL
 */
@Entity
@Table(name = "salon")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Salon.findAll", query = "SELECT s FROM Salon s"),
    @NamedQuery(name = "Salon.findByIdSalon", query = "SELECT s FROM Salon s WHERE s.idSalon = :idSalon"),
    @NamedQuery(name = "Salon.findByHoraDisponible", query = "SELECT s FROM Salon s WHERE s.horaDisponible = :horaDisponible"),
    @NamedQuery(name = "Salon.findByTipo", query = "SELECT s FROM Salon s WHERE s.tipo = :tipo"),
@NamedQuery(name = "Salon.findDuplicity", query ="SELECT s FROM Salon s WHERE s.idSalon = :idSalon")
})
public class Salon implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idSalon")
    private Integer idSalon;
    @Column(name = "horaDisponible")
    private Integer horaDisponible;
    @Size(max = 45)
    @Column(name = "tipo")
    private String tipo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "salonidSalon")
    private List<Materia> materiaList;

    public Salon() {
    }

    public Salon(Integer idSalon) {
        this.idSalon = idSalon;
    }

    public Integer getIdSalon() {
        return idSalon;
    }

    public void setIdSalon(Integer idSalon) {
        this.idSalon = idSalon;
    }

    public Integer getHoraDisponible() {
        return horaDisponible;
    }

    public void setHoraDisponible(Integer horaDisponible) {
        this.horaDisponible = horaDisponible;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    @XmlTransient
    public List<Materia> getMateriaList() {
        return materiaList;
    }

    public void setMateriaList(List<Materia> materiaList) {
        this.materiaList = materiaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSalon != null ? idSalon.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Salon)) {
            return false;
        }
        Salon other = (Salon) object;
        if ((this.idSalon == null && other.idSalon != null) || (this.idSalon != null && !this.idSalon.equals(other.idSalon))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mx.generarhorario.itschapala.modelo.Salon[ idSalon=" + idSalon + " ]";
    }
    
}
